-
Notifications
You must be signed in to change notification settings - Fork 115
refactor: Generalize TabsContent in WorkflowNodesTabs to reduce code duplication (#2227) #3214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Generalize TabsContent in WorkflowNodesTabs to reduce code duplication (#2227) #3214
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
|
Can you resend your code in this PR without the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job @Malay-dev, while your solution does work, it has some problems:
- Anti-pattern: Function-based rendering - The renderTabContent function violates React best practices
- Hard to test - Function-based rendering is difficult to unit test in isolation
- Performance concerns - Function recreated on every render
- Accessibility issues - The function approach makes it harder to implement proper ARIA patterns
If you want to try to improve it, rewrite it using a component-based approach - don't use a function to render the tab content (replace renderTabContent with <TabContent />).
Also, magic numbers are a code smell (tabConfigs[magicNumber]) - we should use a string (maybe matching the tabConfig.value) or something else that is very clear when reading the code as someone who hasn't written it.
ff74a4f to
23bde4b
Compare
23bde4b to
9899943
Compare
|
Hi @kresimir-coko, on my Hactoberfest dashboard, I could see Are we not part of Hactoberfest 2025? |
|
@marko-kriskovic check above comment please |
|
Closing in favor of #3271 Good job @Malay-dev I just reorganized files into a different folder. |
|
Thanks for your support, @kresimir-coko! 🙌 |
|
@Malay-dev thank you for finding the issue. We put the hacktoberfest topic. Perhaps try to close and reopen the PR? |

Description
Refactored the
WorkflowNodesTabscomponent to eliminate code duplication by generalizing four nearly-identicalTabsContentblocks into a single reusable rendering function.Changes made:
TabConfigPropsinterface to define tab configuration structuretabConfigsarray usinguseMemothat centralizes all tab configurationsrenderTabContentfunction that handles the common rendering logicBenefits:
Fixes #2227
Type of change
How Has This Been Tested?
Checklist: